/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Threads;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Luis_Angel
 */
public class testJoin {

    public static void main(String[] args){

        Thread t1 = new Thread(new Runnable(){
            public void run(){
                for (int i = 0; i < 20; i++) {
                    System.out.println(">"+i);
                    try {
                        Thread.currentThread().sleep(500);
                    } catch (InterruptedException ex) {
                       ex.printStackTrace();
                    }
                }
            }
        });

        Thread t2 = new Thread(new Runnable(){
            public void run(){
                for (int i = 0; i < 20; i++) {
                    System.out.println("<"+i);
                    try {
                        Thread.currentThread().sleep(500);
                    } catch (InterruptedException ex) {
                       ex.printStackTrace();
                    }
                }
            }
        });
        try {
            t1.join();
            t1.start();
            t2.start();
            
        } catch (InterruptedException ex) {
            ex.printStackTrace();
        }
    }
}
